package cn.com.nes.site.entity.em.crm.clue;

import cn.com.nes.common.exception.NoSuchEnumException;

import java.util.HashMap;
import java.util.Map;

/**
 * 线索跟进状态 枚举
 *  值域对应 t_param 表 param_type=11
 */
public enum ClueFollowUpStatusEnum {

    NOT_COMMUNICATE("01", "未沟通"),
    FOLLOW_UP("02", "跟进中"),
    POTENTIAL_CUSTOMER("03", "潜在客户"),
    INVALID_CUSTOMER("04", "无效客户"),

    ;

    private String key;

    private String value;

    ClueFollowUpStatusEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static ClueFollowUpStatusEnum getEnum(String key) {
        Map<String, ClueFollowUpStatusEnum> map = new HashMap<>();
        for (ClueFollowUpStatusEnum cluePoolEntryEnum : values()) {
            map.put(cluePoolEntryEnum.getKey(), cluePoolEntryEnum);
        }
        if (!map.containsKey(key)) {
            throw new NoSuchEnumException("未匹配的线索跟进状态");
        }
        return map.get(String.valueOf(key));
    }
}
